package com.cq.ssm.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.cq.ssm.mapper.TitleMapper;
import com.cq.ssm.mapper.TitleMapperCustom;
import com.cq.ssm.po.Title;
import com.cq.ssm.po.TitleCustom;
import com.cq.ssm.service.TitleService;

@Component("titleService")
public class TitleServiceImpl implements TitleService {

	@Autowired
	private TitleMapper tm;
	@Autowired
	private TitleMapperCustom tmc;
	// 插入一条记录
	public boolean insertTitle(Title title) throws Exception {
		int i = tm.insertSelective(title);
		return i==1?true:false;
	}

	// 根据id删除一条记录
	public boolean deleteById(Integer id) throws Exception {
		int i = tm.deleteByPrimaryKey(id);
		return i==1?true:false;
	}

	//根据titleId查询
	public List<TitleCustom> findByTitleId(Integer id) throws Exception {
		return tmc.findByTitleId(id);
	}
}
